<template>
  <div class="wrap">
    <h3>我的积分</h3>
    <h4 v-show="show">当前积分 : <span>{{jifen}}分</span></h4>
    <ul v-show="show">
      <li>
        <span>积分日期</span>
        <span>变动</span>
        <span>来源</span>
      </li>
      <li v-for="(item,index) in arr" v-show="bol">
        <span>{{item.time}}</span>
        <span>{{item.tit1}}</span>
        <span>{{item.tit2}}</span>
      </li>
    </ul>
    <p class="pp" v-show="show1">暂无数据,请登录</p>
  </div>
</template>

<script>
  import axios from 'axios'
    export default {
        name: "Myintegral",
      data(){
          return{
            jifen:0,
            bol:true,
            bol1:false,
            show:true,
            show:false,
            arr:[
              {time:'2015-04-05 16:20:10',tit1:'+100',tit2:'消费赠送'},
              {time:'2015-04-05 16:20:10',tit1:'-100',tit2:'积分商城兑换'},
              {time:'2015-04-05 16:20:10',tit1:'+100',tit2:'消费赠送'},
              {time:'2015-04-05 16:20:10',tit1:'+100',tit2:'消费赠送'},
              {time:'2015-04-05 16:20:10',tit1:'-100',tit2:'积分商城兑换'},
              {time:'2015-04-05 16:20:10',tit1:'+100',tit2:'消费赠送'},
            ]
          }
      },
      mounted(){
        var params=new URLSearchParams();
        params.append('iphone',this.$store.state.phone);

        axios.post('/api/firday/userinfo.php',params).then(res=>{
          var arr1=res.data;
          this.jifen=arr1[0].integral;
          if(this.jifen==0){
            this.bol=false;
            this.bol1=true;
          }else{
            this.bol=true;
            this.bol1=false;
          }
        });

        if(this.$store.state.phone==''){
          this.show=false;
          this.show1=true;
        }else{
          this.show=true;
          this.show1=false;
        }

      }
    }
</script>

<style scoped>
  .wrap{
    width: 1083px;
    height: 623px;
    border: 1px solid #e7e7e7;
  }
  .wrap h3{
    width: 1063px;
    height: 56px;
    line-height: 56px;
    padding-left: 20px;
    font-size: 18px;
    color: #212121;
    border-bottom: 1px solid #e7e7e7;
  }
  .wrap h4{
    width: 1063px;
    height: 56px;
    line-height: 56px;
    padding-left: 20px;
    font-size: 16px;
    color: #212121;
  }
  .wrap h4 span{
    color: #f08200;
  }

  ul{
    width: 1040px;
    margin-left: 20px;
    border: 1px solid #e9e9e9;
  }
  li{
    width: 1040px;
    height: 46px;
    line-height: 46px;
    border-bottom: 1px solid #e9e9e9;
  }
  li:first-child{
    background: #f2f2f2;
    border-bottom:none;
  }
  li:last-child{
    border-bottom:none;
  }
  li span{
    display: inline-block;
    float: left;
    text-align: center;
    font-size: 14px;
  }
  li span:nth-child(1){
    width: 345px;
    height: 46px;
  }
  li span:nth-child(2){
    width: 345px;
    height: 46px;
  }
  li span:nth-child(3){
    width: 350px;
    height: 46px;
  }
  /*p{*/
    /*width: 1040px;*/
    /*height: 46px;*/
    /*line-height: 46px;*/
    /*border: 1px solid #e9e9e9;*/
    /*text-align: center;*/
    /*margin-left: 20px;*/
    /*border-top:none;*/
  /*}*/
  .pp{
    width: 1083px;
    height: 46px;
    line-height: 46px;
    border-bottom: 1px solid #e9e9e9;
    text-align: center;
  }
</style>
